package com.example.attempt.service.impl;

import com.example.attempt.entity.Appeal;
import com.example.attempt.entity.AppealStu;
import com.example.attempt.entity.Grade;
import com.example.attempt.mapper.GradeMapper;
import com.example.attempt.service.GradeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GradeServiceImpl implements GradeService {
    @Autowired
    private GradeMapper gradeMapper;

    @Override
    public List<Grade> queryAll(){
        return gradeMapper.queryAll();
    }

    @Override
    public Grade getGradesByHidSid(int hid, String sid) {
        return gradeMapper.getGradesByHidSid(hid, sid);
    }

    @Override
    public int getNum(int hid, double grade) {
        return gradeMapper.getNum(hid, grade);
    }

    @Override
    public int getDown60Num(int hid){return gradeMapper.getDown60Num(hid);}

    @Override
    public double getAverage(int hid) {
        return gradeMapper.getAverage(hid);
    }

    @Override
    public List<Appeal> getAppeal(String cid){return gradeMapper.getAppeal(cid);}

    @Override
    public List<AppealStu> getStuAppeal(String sid) {
        return gradeMapper.getStuAppeal(sid);
    }

    @Override
    public int updateGradeS1(int SubmitId, double grade){
        gradeMapper.updateGradeS1(SubmitId, grade);
        return 0;
    }

    @Override
    public int updateGradeS2(int SubmitId, double grade){
        gradeMapper.updateGradeS2(SubmitId, grade);
        return 0;
    }

    @Override
    public int updateGradeS3(int SubmitId, double grade){
        gradeMapper.updateGradeS3(SubmitId, grade);
        return 0;
    }

    @Override
    public int updateGradeT(int SubmitId, double grade){
        gradeMapper.updateGradeT(SubmitId, grade);
        return 0;
    }

    @Override
    public int updateGradeA(int SubmitId, double grade){
        gradeMapper.updateGradeA(SubmitId, grade);
        return 0;
    }

    @Override
    public int updateGrade(int hid, String sid, double grade){return gradeMapper.updateGrade(hid, sid, grade);}

    @Override
    public int modifyGrade(int hid, String sid, double grade){
        gradeMapper.modifyGrade(hid, sid, grade);
        return 0;
    }

    @Override
    public int updateAppeal(int hid, String sid, int isAppeal, String reason){return gradeMapper.updateAppeal(hid, sid, isAppeal, reason);}

    @Override
    public int refuseAppeal(int submitId, int isAppeal, String refuseReason){return gradeMapper.refuseAppeal(submitId, isAppeal, refuseReason);}

    @Override
    public int addGrade(Grade grade){
        return gradeMapper.addGrade(grade);
    }
}
